package com.example.springbootweb.bean;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author: wukangrong
 * @date: 2019/8/16 17:28
 * @description: MyInvocationHandler
 */
public class MyInvocationHandler implements InvocationHandler {

    Object fool;

    public MyInvocationHandler(Object fool) {
        this.fool = fool;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        String methodName = method.getName();
        return MethodName.valueOf(methodName).doit(fool, method, args);
    }
}
